package net.util.jport.ports.jdbc;

import net.util.jenco.erl.ErlTerm;

import javax.sql.DataSource;
import java.sql.Connection;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * I manage a connection.
 */
public class ConnectionHandler extends Thread {

    private final String name;
    private final BlockingQueue<ErlTerm> queue;
    private final DataSource dataSource;

    public static String NAME_PREFIX = "CONN_HANDLER";

    public ConnectionHandler(String name, DataSource dataSource) {
        super(NAME_PREFIX+"-"+name);
        this.name = name;
        this.dataSource = dataSource;
        this.queue = new LinkedBlockingQueue<ErlTerm>();
    }

    @Override
    public void run() {

        Connection conn = null;
        boolean stop = false;

        while (! stop) {




        }


    }
}
